<!--
 * @Author: 花香蝶自来 1026583651@qq.com
 * @Date: 2024-04-16 18:35:31
 * @LastEditors: 花香蝶自来 1026583651@qq.com
 * @LastEditTime: 2024-05-28 22:38:44
 * @FilePath: /crm/components/formz/components/formselect.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<view class="">
		<u-popup :show="showfalg" mode="right" width="500rpx">
			<u-navbar title="客户类型" :autoBack="false" @leftClick="popupback" />
			<view style="width: 750rpx;">
				<u-list>
					<u-list-item v-for="(item, index) in list" :key="index">
						<u-cell :title="item.name" @click="tap(item)">

						</u-cell>
					</u-list-item>
				</u-list>
			</view>
		</u-popup>
		<customers1 ref="customers1" :item="item" @change="change"></customers1>
	</view>
</template>

<script>
	import {
		getCustomerTypes
	} from "@/apis/customer/index"
	import customers1 from "./customers1.vue";
	export default {
		components: {
			customers1
		},
		data() {
			return {
				showfalg: false,
				list: []
			};
		},

		props: {
			item: {
				typeof: Object,
				default: () => {
					return {};
				},
			}
		},

		methods: {
			async show() {
				this.showfalg = true
				let list = await getCustomerTypes();
				// list = list.data.records
				this.list = list.records
			},
			popupback(e) {
				this.showfalg = false
			},
			tap(item) {
				this.$refs.customers1.show({
					customTypeId: item.id
				});
			},
			change(item) {
				this.$emit("change", item)
				this.showfalg = false
			}
		},
	};
</script>

<style></style>